﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>编辑角色</title>
     <link href="../css/main.css" rel="stylesheet" type="text/css" />
    <link href="../css/Jqbox.css" rel="stylesheet" type="text/css" />
    <link href="../css/jquery.loadmask.css" rel="stylesheet" type="text/css" />
    <script src="../Js/jquery-1.5.2.min.js" type="text/javascript"></script>
    <script src="../Js/ligerui.min.js" type="text/javascript"></script>
    <script src="../Js/jquery.dialog.js" type="text/javascript"></script>
    <script src="../Js/jquery.loadmask.min.js" type="text/javascript"></script>
    <script src="../Js/json2.js" type="text/javascript"></script>
    <script src="../Js/conmon.js" type="text/javascript"></script>
    <script type="text/javascript">
        var Row = null;
        var pWind = null;
        $(function () {
            $("#from1").ligerForm();
            //$selectRow
            pWind = parent.window.parent.window.getWindow();
            Row = (pWind != null ? pWind.$selectRow : null);
            if (Row != null) {
                var Tdata = [{ id: 0, text: '普通员' }, { id: 1, text: '管理员' }, { id: 2, text: '公共'}];
                $("#txtPower").ligerComboBox({ width: 140, slide: false, data: Tdata, initValue: Row.R_POWER });
                $("#txtName").val(Row.R_NAME);
                $("#txtRemark").val(Row.R_REMARK);
            //保存
            $("#btnSave").click(function () {
                if (chk()) {
                    if (Row) {

                        Row.R_NAME = $("#txtName").val();
                        Row.R_POWER = $("#txtPower_val").val();
                        Row.R_REMARK = $("#txtRemark").val();

                       // $("#txtPower").ligerComboBox().selectValue(Row.R_POWER);

                        var pars = { data: JSON2.stringify(Row) };
                        $("body").mask("数据处理中，请稍候......");
                        $.post('../WebServer/MainAdmin.ashx?Action=UpdateRoleNew', pars, function (data) {
                            $("body").unmask();
                            var rdata = eval("(" + data + ")");
                            if (rdata.IsSuccess == 1) {
                                showAlertOk("保存成功");
                                if (pWind) pWind.loadGrid();
                            } else {
                                if (rdata.IsSuccess == -99)
                                    showErrorTip("该角色名已经存在");
                                else
                                    showErrorTip(rdata.Msg);
                            }
                        });
                    } //end row
                } //end chk
            });

        }
            $("#btnCancel").click(function () { closeRefresh(false, ""); });

        });


        function chk() {
            var err = "";

            if ($.trim($("#txtName").val()) == "") {
                err = "请输入职务名称!";
                showErrorTip(err);
                return false;
            }

            if ($.trim($("#txtPower").val()) == "") {
                err = "请选择状态!";
                showErrorTip(err);
                return false;
            }


            return true;
        }
      
    </script>

     <style type="text/css">
        .edittable td.editcellmessage,.edittable td.editcellverify,.edittable td.editcell{ padding:5px;line-height:25px;}
        .edittable td.editcellmessage{ padding-left:20px;} 
        body { font-size:12px; background:white;}
         
    </style>
</head>
<body>
<form id="from1" action="">
     <table cellpadding="0" border="0" cellspacing="0" class="edittable">
        <tr>
         <td  class="editcellmessage">职务名称:</td>
         <td class="editcellmessage"> <input id="txtName" name="txtName" type="text" ltype="text" /> </td>
        </tr>
       
       
         <tr>
              <td  class="editcellmessage">状态:</td>
              <td  class="editcellmessage"> <input id="txtPower" name="txtPower" type="text"  /> </td>
        </tr>
       <tr>
            <td  class="editcellmessage">备注:</td>
            <td class="editcellmessage">
             <textarea id="txtRemark" name="txtRemark" cols="100" rows="4" class="l-textarea" style="width:200px"></textarea>
            </td>
        </tr>
   </table>
       <div class="buttonpanel">
             <div style="float:right;margin-right:10px;">
                 <a id="btnSave" class="button" href="javascript:void(0);"><span>保存</span></a>
                 <a id="btnCancel" class="button" href="javascript:void(0);"><span>关闭</span></a>
              </div>
      </div>
   </form>
</body>
</html>